console.log('ok');

$('#btnAdd').click(function () {
    window.location.href = '/Product/createOrEdit'
})



$('#btnSave').click(function () {
    let id = $('[name=id]').val();
    let ProductName = $('[name=ProductName]').val();
    let supplier = $('[name=supplier]').val();
    let price = $('[name=price]').val();
    let stock = $('[name=stock]').val();
    let remarks = $('[name=remarks]').val();
    let obj =
    {
        id,
        ProductName,
        supplier,
        price,
        stock,
        remarks
    }
    console.log(obj);
    $.post('/product/save', obj, function (res) {
        console.log(res);
        window.location.href = '/product/index'
    })
})


$('#btnCancel').click(function () {
    window.location.href = '/product/index'
})


function btnEdit(id) {
    window.location.href = `/product/createOrEdit/${id}`
}

function btnDel(id) {
    let del = '确认删除？'
    if (confirm(del)) {
        window.location.href = `/product/Delete/${id}`
    } else {
        console.log('取消删除！')
    }
}